<?php

$q = strtolower($_GET["q"]);
if (!$q) return;
/*mysql_connect('localhost','root','');
mysql_select_db('test'); */

define ( 'MYSQL_HOST', 'localhost' );
define ( 'MYSQL_USER', 'dbu1153130' );
define ( 'MYSQL_PASSWORD', 'testokI040336' );
define ( 'MYSQL_DATABASE', 'db1153130-testdb2' );
mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD);
mysql_select_db( MYSQL_DATABASE );
mysql_query("SET NAMES 'utf8'");
mysql_query('SET CHARACTER SET utf8');
mysql_set_charset  ("utf-8" );
$result=mysql_query("SELECT canword FROM germanspanish WHERE canword like '$q%' ORDER BY canword LIMIT 6 COLLATE latin1_german2_ci ");
if ( ! $result ) { die('Error query: ' . mysql_error()); }

for($count = 1; $count <= 5; $count++) 
{
    $row=mysql_fetch_array($result);
    print $row[0]."|".$row[1]."\n"; 
}

/*foreach ($items as $key=>$value) {
	if (strpos(strtolower($key), $q) !== false) {
		echo "$key|$value\n";
	}
}*/
/*for($count = 1; $count < 60000; $count++)
{
$random_word='';
    for($count2 = 1; $count2 < 10; $count2++)
	{$random_word.=chr(rand(97,122));}
mysql_query("INSERT INTO Englisch VALUES ('$random_word','$random_word')");
}
;*/

?>
